package com.yanqu.road.logic.activity.foxcard.game.label;

import com.yanqu.road.entity.activity.foxcard.FoxSaleCard;
import com.yanqu.road.logic.activity.foxcard.FoxCardConfig;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardCouponType;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.List;

/**
 * 立即获得x张y品质的小丑牌，满了则直接消失
 * 数量|品质|0|0
 */
public class FoxCardLabel10 extends FoxCardLabelBase {
    @Override
    protected int labelHandle(FoxCardGameLogic gameLogic) {
        if (triggerType != eFoxCardTriggerType.SKIP) {
            return 0;
        }

        int cardNum = labelConfig.getParamList().get(0);
        int cardQuality = labelConfig.getParamList().get(1);

        FoxCardConfig config = gameLogic.getConfig();
        List<FoxSaleCard> foxSaleCards = config.randomEffectCard(gameLogic.getGameData().getEffectCards(), cardQuality, cardNum, -1, gameLogic.getCouponAddValue(eFoxCardCouponType.COUPON8.getValue()));
        for (FoxSaleCard foxSaleCard : foxSaleCards) {
            if (!config.isBuffType8(foxSaleCard.getVersionEffect()) && gameLogic.getGameData().getEffectCards().size() >= gameLogic.getGameData().getEffectCardNumLimit()) {//负片不用判断槽位
                continue;
            }
            gameLogic.addNewEffectCard(foxSaleCard.getConfigId(), foxSaleCard.getVersionEffect());
        }

        return 1;

    }
}
